home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Utilities Professional 1-1500
/
Utilities Professional 1-1500 (1994)(WPD)[!].iso
/
12511500
/
var1411.dms
/
var1411.adf
/
include
/
Startup.i
Wrap
Text File
|
1993-07-28
|
1KB
|
60 lines
*
* Standard opening routine, which allows for starting from CLI or workbench
* modified example taken from the ROM Kernal Reference Manual
* - Libraries & Devices
*
* include this at the very start of your program, after your list of includes
*
* requires 'exec/exec_lib.i'
IFND EXEC_EXEC_I
include exec/exec.i
ENDC
IFND DOS_DOSEXTENS_I
include dos/dosextens.i
ENDC
movem.l d0/a0,-(sp) Save CLI command
clr.l .WbMsg
sub.l a1,a1 Get out task
move.l $4.w,a6
jsr _LVOFindTask(a6)
move.l d0,a5
tst.l pr_CLI(a5) Is it from CLI ?
bne.s .Join
.Wkbnch lea pr_MsgPort(a5),a0 Wait for workbench message
jsr _LVOWaitPort(a6)
lea pr_MsgPort(a5),a0 Get that message
jsr _LVOGetMsg(a6)
move.l d0,.WbMsg save it for later
.Join movem.l (sp)+,d0/a0 retore CLI registers
bsr.s .Main call our program
move.l .WbMsg(pc),d1 Check for workbench start
beq.s .CLI
move.l d0,-(sp) save exit code
move.l $4.w,a6
jsr _LVOForbid(a6) Stop exec task switching
move.l .WbMsg(pc),a1 reply to workbench message
jsr _LVOReplyMsg(a6) - Workbench kills off our task
move.l (sp)+,d0 restore exit code
.CLI rts
.WbMsg dc.l 0 Message provided by Workbench startup
* Your program starts here
.Main